package com.scau.service.impl;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import com.scau.dao.IEmplCateDao;
import com.scau.service.IEmplCateService;
import com.scau.util.DateTransform;
import com.scau.vo.EmployeeCategory;

/**
 * @author Jinglun
 * @create 2017年4月19日
 */
public class EmplCateServiceImpl implements IEmplCateService {

	private IEmplCateDao emplCateDao;
	
	@Override
	public boolean saveEmplCate(EmployeeCategory employeeCategory) {
		// 设置当前时间为创建时间
		Date date = new Date();
		DateTransform dt = new DateTransform();
		Timestamp create = dt.dToTimestamp(date);
		employeeCategory.setGmtCreate(create);
		return emplCateDao.saveEmplCate(employeeCategory);
	}

	@Override
	public boolean deleteEmplCate(int id) {
		return emplCateDao.deleteEmplCate(id);
	}

	@Override
	public boolean updateEmplCate(EmployeeCategory employeeCategory) {
		// 设置当前时间为修改时间
		Date date = new Date();
		DateTransform dt = new DateTransform();
		Timestamp modified = dt.dToTimestamp(date);
		employeeCategory.setGmtModified(modified);
		
		return emplCateDao.updateEmplCate(employeeCategory);
	}

	@Override
	public List<EmployeeCategory> listEmplCate() {
		return emplCateDao.listEmplCate();
	}

	// get,set methods
	public IEmplCateDao getEmplCateDao() {
		return emplCateDao;
	}

	public void setEmplCateDao(IEmplCateDao emplCateDao) {
		this.emplCateDao = emplCateDao;
	}

	
}
